-- ShopDrawVo

local fileName = string.getModeName(...)
local ClassRef = class(fileName)

function ClassRef:ctor(data, type)
	if data then
		self:init(data, type)
	end
end

-- message DrawCardShowLoot
-- {
--     pb_loot.Loot dropLoot = 1; //实际获得的奖励
-- }
function ClassRef:init(data, type)
	if type == 1 then
		-- 单抽的幸运宝箱结构
		self.itemData = UD:parseLootToBagItem(data.dropLoot)
		if not self.itemData then
			self.itemData = UD:parseLootToBagItem({id=79999933, num=10, type="item"})
		end
		-- 不是luckbox，但是想借用luckbox，所以凑出来数据
		if self.itemData.getQuality then
			self.quality = self.itemData:getQuality()
		else
			self.quality = 1
		end
		-- 策划说金币特殊处理为紫色
		if self.itemData.tid == 99 then
			self.quality = 4
		end
	elseif type == 2 then
		-- 十连抽的Lottery结构
		self.dropItemData = UD:parseLootToBagItem(data.dropLoot)
		if not self.dropItemData then
			self.dropItemData = UD:parseLootToBagItem({id=79999933, num=10, type="item"})
		end
	end	
end

-- 是否是坐骑
function ClassRef:getMount()
	if self.replaceItemData and self.replaceItemData.itemBagType == Enums.ItemBagType.mount then
		return self.replaceItemData, self.dropItemData
	elseif self.dropItemData.itemBagType == Enums.ItemBagType.mount then
		return self.dropItemData
	end
end

return ClassRef